
file (GLOB MOVESENSE_SOURCES
      "*.cpp")

if(WIN32)
    aux_source_directory("./cameraDS" CAMERA_BASE_SOURCES)
#     aux_source_directory("./cameraUSB" CAMERA_USB_SOURCES)
    include_directories ("../Dependencies/directshow/include"
                         "../Dependencies/libusb-1.0.21/include"
                         "./cameraDS"
                         "./cameraUSB") 
    set(LIBS "strmiids")
    if(NOT DEFINED CMAKE_DEBUG_POSTFIX)
        set(CMAKE_DEBUG_POSTFIX "D")
    endif()

else(UNIX)
    aux_source_directory("./cameraV4L" CAMERA_BASE_SOURCES)
    include_directories ("./cameraV4L")  
    link_directories("/usr/lib/x86_64-linux-gnu")  
    set(LIBS "udev")
endif(WIN32)

list(APPEND MOVESENSE_SOURCES ${CAMERA_BASE_SOURCES})
list(APPEND MOVESENSE_SOURCES ${CAMERA_USB_SOURCES})
source_group("" FILES ${MOVESENSE_SOURCES})

include_directories ("../Dependencies/rapidjson-1.1.0/include"
                     "./")        

add_library(MoveSenseCamera SHARED ${MOVESENSE_SOURCES})

target_link_libraries(MoveSenseCamera ${LIBS})

set_property(TARGET MoveSenseCamera PROPERTY FOLDER "Libraries")

set_target_properties(MoveSenseCamera PROPERTIES
                      RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)

if(WIN32)
install (TARGETS MoveSenseCamera
        RUNTIME DESTINATION ${PROJECT_SOURCE_DIR}/Release/MoveSenseSDK-Windows/lib
        ARCHIVE DESTINATION ${PROJECT_SOURCE_DIR}/Release/MoveSenseSDK-Windows/lib)
        
install(FILES 
        ${CMAKE_CURRENT_SOURCE_DIR}/MS_MACRO.h
        ${CMAKE_CURRENT_SOURCE_DIR}/CameraBase.h
        ${CMAKE_CURRENT_SOURCE_DIR}/CameraInfo.h
        ${CMAKE_CURRENT_SOURCE_DIR}/CameraPara.h
        ${CMAKE_CURRENT_SOURCE_DIR}/CameraSetting.h
        ${CMAKE_CURRENT_SOURCE_DIR}/MoveSenseCamera.h
        DESTINATION ${PROJECT_SOURCE_DIR}/Release/MoveSenseSDK-Windows/include)

install(DIRECTORY 
        ${CMAKE_CURRENT_SOURCE_DIR}/../ConfigFiles
        DESTINATION ${PROJECT_SOURCE_DIR}/Release/MoveSenseSDK-Windows
        COMPONENT dev)
    
else(UNIX)

# Linux Release
install(DIRECTORY 
        ${CMAKE_CURRENT_SOURCE_DIR}/../Dependencies/rapidjson-1.1.0
        DESTINATION ${PROJECT_SOURCE_DIR}/Release/MoveSenseSDK-Linux/Dependencies
        COMPONENT dev)
   
install(DIRECTORY 
        ${CMAKE_CURRENT_SOURCE_DIR}/../MoveSenseCamera/cameraV4L
        DESTINATION ${PROJECT_SOURCE_DIR}/Release/MoveSenseSDK-Linux/MoveSenseCamera
        COMPONENT dev)
   
install(DIRECTORY 
        ${CMAKE_CURRENT_SOURCE_DIR}/../ConfigFiles
        DESTINATION ${PROJECT_SOURCE_DIR}/Release/MoveSenseSDK-Linux
        COMPONENT dev)

file (GLOB MOVESENSE_FILES "*.*")   

install (FILES
	${MOVESENSE_FILES}
	DESTINATION ${PROJECT_SOURCE_DIR}/Release/MoveSenseSDK-Linux/MoveSenseCamera)

endif(WIN32)
